library(stringr)
library(ggplot2)

path='4001902.0'
path=paste('class/',path,sep='')
path=paste(path,'/',sep='')

allCSV=list.files(path=path,pattern="*.csv")
len=length(allCSV)

# 算不及格数量
fail=c()
for(i in 1:len)
{
  csvPath=paste(path,allCSV[i],sep='')
  x=read.csv(csvPath)
  tlen <- nrow(x)
  
  failNum=0
  for(j in 1:tlen)
  {
    if(x[j,3]<60)
      failNum=failNum+1
  }
  
  fail[i]=failNum
}

# 拆班级名
name=c()
for(i in 1:len)
{
  l=unlist(strsplit(allCSV[i],split="_"))
  name[i]=l[1]
}

name = str_wrap(name, width = 5)
barplot(fail, names.arg = name)
